package com.oscar.ehome.utils.util;

import java.util.Date;

/**
 * Created by Administrator on 2017/3/24.
 * 时间戳
 */

public class makeTime {
    public static String mtime() {
        String time = "";
        long time1 = new Date().getTime();
        time = String.valueOf(time1);
        return time;
    }

    public static String getDistanceTime(long time1, long time2) {
        long day = 0;
        long hour = 0;
        long min = 0;
        long sec = 0;
        long diff;
        String flag;
        if (time1 < time2) {
            diff = time2 - time1;
            flag = "前";
        } else {
            diff = time1 - time2;
            flag = "后";
        }
//        day = diff /／ / (60 * 1000)) - day * 24 * 60 - hour * 60);
        sec = (diff / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - min * 60);
        if (day != 0) return day + "天" + flag;
//        if(hour!=0)return hour+"小时"+flag;
//        if(min!=0)return min+"分钟"+flag;
        return sec + "";
    }

}
